home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / BASIC / LIB / EVENTSHELL / EXTENSION / FontMenu (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1996-01-20  |  8KB  |  175 lines

  1.  Module FontMenu
  2.  -----------------------------------------------------------------------
  3.  FontMenu Handling Routines (version 1.07 29-Dec-95)
  4.  This library contains routines that handle the interface to the
  5.  FontMenu Relocatable Module by Joris R
  6. ling (version 1.16)
  7.  -----------------------------------------------------------------------
  8.  Structure of Data used in this module
  9.  Public Methods Supported:
  10.    FN_shell_FontMenu_Init                 Initialises module
  11.    FNshell_FontMenu_IsInitialised
  12.    FNshell_FontMenu_GetHandle
  13.    FNshell_FontMenu_OffersSystemFont
  14.    FNshell_FontMenu_GetLastSelectedFont
  15.    FNshell_FontMenu_GetNrFonts
  16.    PROCshell_AttachFontMenu
  17.    PROCshell_AttachFontSubMenu
  18.    PROCshell_FontMenu_SelectFont
  19.    PROCshell_FontMenu_AllowSystemFont
  20.    PROCshell_FontMenu_DisallowSystemFont
  21.    PROCshell_FontMenu_SelectFont
  22.  Responses to events raised by other modules
  23.    PROCshell_FontMenu_ShowMenu
  24.    PROCshell_FontMenu_Deregister
  25.  Private Methods Supported:
  26.    PROCshell_FontMenu_Init
  27.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28.  Public routines..
  29.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  30. +"*|Start FN_shell_FontMenu_Init
  31. _shell_FontMenu_Init
  32.  Module constants
  33. /$_c_FontMenu_NotDefined%     = -1
  34. 0._c_FontMenu_SystemFont$     = "SystemFont"
  35. 1%_c_FontMenu_MaxNameLength%  = 256
  36. 2#_c_FontMenu_ValidSelFlag%   = 1
  37. 4=_c_FontMenu_ErrMess_Create$ = "Unable to create FontMenu"
  38. 5A_c_FontMenu_ErrMess_Load$   = "FontMenu module is not loaded"
  39.  Module variables
  40. 8;_m_FontMenu_Handle%           = _c_FontMenu_NotDefined%
  41. 9%_m_FontMenu_Initialised%      = 
  42. :&_m_FontMenu_LastSelectedFont$ = ""
  43. ;%_m_FontMenu_NrFontsFound%     = 0
  44. <%_m_FontMenu_OfferSystemFont%  = 
  45. @!*|Stop FN_shell_FontMenu_Init
  46. D'*|Start FNshell_FontMenu_GetNrFonts
  47. shell_FontMenu_GetNrFonts
  48. = _m_FontMenu_NrFontsFound%
  49. H&*|Stop FNshell_FontMenu_GetNrFonts
  50. L.*|Start PROCshell_FontMenu_AllowSystemFont
  51. shell_FontMenu_AllowSystemFont
  52. N$_m_FontMenu_OfferSystemFont% = 
  53. shell_FontMenu_SelectFont( _m_FontMenu_LastSelectedFont$ )
  54. R-*|Stop PROCshell_FontMenu_AllowSystemFont
  55. V1*|Start PROCshell_FontMenu_DisallowSystemFont
  56. shell_FontMenu_DisallowSystemFont
  57. X$_m_FontMenu_OfferSystemFont% = 
  58. shell_FontMenu_SelectFont( _m_FontMenu_LastSelectedFont$ )
  59. \0*|Stop PROCshell_FontMenu_DisallowSystemFont
  60. `/*|Start FNshell_FontMenu_ContainsSystemFont
  61. shell_FontMenu_OffersSystemFont
  62. b"= _m_FontMenu_OfferSystemFont%
  63. c.*|Stop FNshell_FontMenu_ContainsSystemFont
  64. g$*|Start PROCshell_AttachFontMenu
  65. *|Define Using_FontMenu
  66. shell_AttachFontMenu( wh%, menuic%, display_ic%, sel_fn$, maker_fn$ )
  67. shell_FontMenu_Init
  68.  wh% > 0 
  69.  menuic% >= 0 
  70. shell_IconSetButtonType( wh%, menuic%, 3 )
  71. shell_EvntAdd_PopUpMenu( 
  72. shell_GetWindowIdentifier( wh% ), menuic%, display_ic%, _POPUP_TYPE_FONTMENU, sel_fn$, maker_fn$, _POPUP_TYPE_FONTMENU )
  73.  PROCshell_Tracef0( "AttachFontMenu:Attaching font menu" )
  74. v#*|Stop PROCshell_AttachFontMenu
  75. z'*|Start PROCshell_AttachFontSubMenu
  76. *|Define Using_FontMenu
  77. shell_AttachFontSubMenu(item%,warn_fn$,sel_fn$)
  78.  itemstart%,menu%,temp%,ctr%
  79. shell_FontMenu_Init
  80.  "MenuUtil_SubMenu",item%,_m_FontMenu_Handle%
  81.  "MenuUtil_Warning",,
  82.  Store menu ptr in shell memory..
  83. !_U%!252 = _m_FontMenu_Handle%
  84. shell_EventListMenuWarn(item%,_m_FontMenu_Handle%,warn_fn$,sel_fn$)
  85. *|ifdef PROCshell_TraceInit
  86. shell_Tracef0("AttachFontSubMenu:Attaching font menu &"+
  87. ~_m_FontMenu_Handle% )
  88. *|endif
  89. &*|Stop PROCshell_AttachFontSubMenu
  90. )*|Start PROCshell_FontMenu_SelectFont
  91. shell_FontMenu_SelectFont( fontname$ )
  92.  fontname$ = "" 
  93.  "FontMenu_Select", "" + 
  94. ( 0 ), _m_FontMenu_OfferSystemFont% 
  95.  , _m_FontMenu_Handle%
  96.  "FontMenu_Select",fontname$, _m_FontMenu_OfferSystemFont% 
  97.  , _m_FontMenu_Handle%
  98. -_m_FontMenu_LastSelectedFont$ = fontname$
  99. *|ifdef TraceInit
  100. shell_Tracef0("FontMenuSelectFont:Font is '"+fontname$+"'")
  101. *|endif
  102. (*|Stop PROCshell_FontMenu_SelectFont
  103. 0*|Start FNshell_FontMenu_GetLastSelectedFont
  104. shell_FontMenu_GetLastSelectedFont
  105. #= _m_FontMenu_LastSelectedFont$
  106. /*|Stop FNshell_FontMenu_GetLastSelectedFont
  107. **|Start FNshell_FontMenu_IsInitialised
  108. shell_FontMenu_IsInitialised
  109. = _m_FontMenu_Initialised%
  110. )*|Stop FNshell_FontMenu_IsInitialised
  111. &*|Start FNshell_FontMenu_GetHandle
  112. shell_FontMenu_GetHandle
  113. = _m_FontMenu_Handle%
  114. %*|Stop FNshell_FontMenu_GetHandle
  115. #*|Start FNshell_FontMenu_Decode
  116. shell_FontMenu_Decode( select_block% )
  117.  menu_block%, fontmenuflag%, selected_font$
  118. Emenu_block% = 
  119. shell_HeapBlockFetch( _c_FontMenu_MaxNameLength% )
  120.  "FontMenu_DecodeFontMenu", select_block%, menu_block% 
  121.  fontmenuflag%
  122. selected_font$ = ""
  123.  fontmenuflag% = _c_FontMenu_ValidSelFlag% 
  124.  sensible selection made..
  125. 6  selected_font$ = 
  126. shell_GetString( menu_block% )
  127.  selected_font$ = "" 
  128. 0    selected_font$ = _c_FontMenu_SystemFont$
  129. shell_FontMenu_SelectFont( selected_font$ )
  130. Evnts_GetLastMouseButton = _MSE_ADJUSTBUT 
  131. _    
  132.  "Wimp_CreateMenu", , 
  133. shell_MenuLastHandle, 
  134. shell_MenuLastXPos, 
  135. shell_MenuLastYPos
  136. shell_HeapBlockReturn( menu_block% )
  137. = selected_font$
  138. "*|Stop FNshell_FontMenu_Decode
  139.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  140.  Responses to events raised by other modules..
  141.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  142. )*|Start PROCshell_FontMenu_Deregister
  143. shell_FontMenu_Deregister
  144.  Called when application closes down. Allows FontMenu to kill
  145.  itself when the number of users falls to zero.
  146.  "XFontMenu_Release"
  147. (*|Stop PROCshell_FontMenu_Deregister
  148. '*|Start PROCshell_FontMenu_ShowMenu
  149. shell_FontMenu_ShowMenu( _Q%, _window_handle%, _icon_handle%, popup% )
  150.  _m_FontMenu_Initialised% = 
  151. shell_FontMenu_Init
  152. shell_HandleMenuOpen( _Q%, _m_FontMenu_Handle%, _window_handle%, _icon_handle%, 
  153. &*|Stop PROCshell_FontMenu_ShowMenu
  154.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  155.  Private module routines
  156.  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  157. #*|Start PROCshell_FontMenu_Init
  158. shell_FontMenu_Init
  159.  flags%
  160.  _m_FontMenu_Initialised% = 
  161.  ( "RMEnsure FontMenu 1.16 Error " + _c_FontMenu_ErrMess_Load$ )
  162.  "XFontMenu_Create" 
  163.  _m_FontMenu_NrFontsFound%;flags%
  164.  flags% 
  165. )    
  166.  99, _c_FontMenu_ErrMess_Create$
  167. [    
  168.  "FontMenu_Select", "" + 
  169. 0, _m_FontMenu_OfferSystemFont% 
  170.  , _m_FontMenu_Handle%
  171. $    _m_FontMenu_Initialised% = 
  172. $    
  173. shell_ExReg_FontMenu_Loaded
  174. "*|Stop PROCshell_FontMenu_Init
  175.